<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>addDept</title>
	
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
       <script src="../script/jquery-1.9.1.js" type="text/javascript"></script>
  </head>
  
  <body>
  	<form method="post" action="">
  		部门名称<input type="text" id="dname" name="dept.dname" /> 
  		部门地址<input type="text" id="loc" name="dept.loc" /> 
  		部门地址<input type="text" id="deptno" name="dept.deptno" /> 
  		<input type="button" onclick="tj();" value="提交" />
  	</form>
  	<script>
  		var s = window.dialogArguments;
  		var operator = "";
  		$(document).ready(function (){
  	  		if(s != "" && s!=null){
  	  	  		//修改
  	  	  		operator = "update";
		  		$.post("tt.action",{id:s},function (d){
					$("#dname").val(d[0].dname);
					$("#loc").val(d[0].loc);
					$("#deptno").val(d[0].deptno);
		  	  	});
		  	  	
  	  		}
  	  	});

		function tj(){
			if(operator == "update"){
				var dept = {
					dept.deptno : $("#deptno").val(),
					dept.dname : $("#dname").val(),
					dept.loc : $("#loc").val(),
				};
				$.post("updateDept.action",dept,function (d){
					alert(d);
				})
			}
		}
  	  	//项目当中用过ajax (哪些|jquery) (登陆用过) 判断用户名
  	</script>
  </body>
</html>
